<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Amici</title>
</head>
<body>
    <form name="bacheca" method="post" action="BachecaServlet">
      <input type="hidden" name="username" value="<%=request.getAttribute("session") %>">
      <input type="hidden" name="nome" value="<%=request.getAttribute("nome") %>">
      <input type="hidden" name="cognome" value="<%=request.getAttribute("cognome") %>">
   </form>
   <form name="notifiche" method="post" action="NotificheServlet">
      <input type="hidden" name="username" value="<%=request.getAttribute("session") %>">
      <input type="hidden" name="nome" value="<%=request.getAttribute("nome") %>">
      <input type="hidden" name="cognome" value="<%=request.getAttribute("cognome") %>">
   </form>
    <form name="ricerca" method="post" action="Ricerca.jsp">
      <input type="hidden" name="id" value="<%=request.getAttribute("session") %>">
      <input type="hidden" name="nome" value="<%=request.getAttribute("nome") %>">
      <input type="hidden" name="cognome" value="<%=request.getAttribute("cognome") %>">
   </form>
   <p>
      <a href="javascript:document.bacheca.submit()">Bacheca</a>
      <a href="javascript:document.notifiche.submit()">Notifiche</a>
      <a href="MostraMioProfiloServlet?id=<%= request.getAttribute("session") %>"><%= request.getAttribute("nome") %><%= request.getAttribute("cognome") %></a>
      <a href="javascritp:document.ricerca.submit()">Ricerca</a>
      <a href="LogoutServlet?username=<%= request.getAttribute("session")%>&user=utente">Logout</a>
   </p>

<%   int size = Integer.parseInt(request.getAttribute("size").toString());
     String id = request.getAttribute("session").toString();
   
     if(size == 0) {
	  
	     out.println("Nessun amico trovato");
	   
      }
   
      else {
    	  
    	 for(int i = 0; i < size; i++) {
    		 
    	  String username = request.getAttribute("el" + i).toString();
   		  out.println("<a href=\"ProfiloUtenteServlet?username=" + username + "&from=amici&session=" + id + "\">");
   		  out.println(request.getAttribute("el" + i));
   		  out.println("</a>");
   		  out.println("<br/>");
    		 
    	 }
    	  
      }
%>  
</body>
</html>